[3.9] bpo-45461: Fix IncrementalDecoder and StreamReader in the "unicode-escape"...
authorSerhiy Storchaka <storchaka@gmail.com>
Thu, 14 Oct 2021 17:03:29 +0000 (20:03 +0300)
committerArnaud Rebillout <arnaudr@debian.org>
Tue, 14 Apr 2026 04:38:32 +0000 (11:38 +0700)
commit95d0fedb8ae0c6a001a4c8122288abe22242f13a
tree79df01e5d37f3a4e287d349986d53c2854ae5fb9
parent6a22a784f7d27efc6c09fcf5d5863230f2c98819
[3.9] bpo-45461: Fix IncrementalDecoder and StreamReader in the "unicode-escape" codec (GH-28939) (GH-28945)

They support now splitting escape sequences between input chunks.

Add the third parameter "final" in codecs.unicode_escape_decode().
It is True by default to match the former behavior.
(cherry picked from commit c96d1546b11b4c282a7e21737cb1f5d16349656d)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Origin: backport, https://github.com/python/cpython/commit/7c722e32bf582108680f49983cf01eaed710ddb9

Gbp-Pq: Name CVE-2025-4516-1.patch
Include/cpython/unicodeobject.h
Lib/encodings/unicode_escape.py
Lib/test/test_codecs.py
Misc/NEWS.d/next/Library/2021-10-14-00-19-02.bpo-45461.4LB_tJ.rst [new file with mode: 0644]
Modules/_codecsmodule.c
Modules/clinic/_codecsmodule.c.h
Objects/unicodeobject.c
Parser/pegen/parse_string.c
Python/ast.c